load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "execbuilder",
    srcs = [
        "builder.go",
        "cascades.go",
        "col_ord_map.go",
        "format.go",
        "mutation.go",
        "relational.go",
        "scalar.go",
        "statement.go",
    ],
    importpath = "github.com/cockroachdb/cockroach/pkg/sql/opt/exec/execbuilder",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/kv/kvserver/concurrency/isolation",
        "//pkg/server/telemetry",
        "//pkg/sql/catalog/colinfo",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/execinfra",
        "//pkg/sql/lexbase",
        "//pkg/sql/opt",
        "//pkg/sql/opt/cat",
        "//pkg/sql/opt/constraint",
        "//pkg/sql/opt/distribution",
        "//pkg/sql/opt/exec",
        "//pkg/sql/opt/exec/explain",
        "//pkg/sql/opt/memo",
        "//pkg/sql/opt/norm",
        "//pkg/sql/opt/ordering",
        "//pkg/sql/opt/props",
        "//pkg/sql/opt/props/physical",
        "//pkg/sql/opt/xform",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/row",
        "//pkg/sql/sem/builtins/builtinsregistry",
        "//pkg/sql/sem/catconstants",
        "//pkg/sql/sem/eval",
        "//pkg/sql/sem/tree",
        "//pkg/sql/sem/tree/treebin",
        "//pkg/sql/sem/tree/treecmp",
        "//pkg/sql/sem/tree/treewindow",
        "//pkg/sql/sem/volatility",
        "//pkg/sql/sqlerrors",
        "//pkg/sql/sqltelemetry",
        "//pkg/sql/types",
        "//pkg/util",
        "//pkg/util/buildutil",
        "//pkg/util/encoding",
        "//pkg/util/errorutil",
        "//pkg/util/errorutil/unimplemented",
        "//pkg/util/intsets",
        "//pkg/util/log",
        "//pkg/util/metamorphic",
        "//pkg/util/timeutil",
        "//pkg/util/treeprinter",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_cockroachdb_redact//:redact",
    ],
)

go_test(
    name = "execbuilder_test",
    size = "small",
    srcs = [
        "col_ord_map_test.go",
        "main_test.go",
        "mutation_test.go",
    ],
    data = [
        ":testdata",
        "//c-deps:libgeos",
    ],
    embed = [":execbuilder"],
    deps = [
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/server",
        "//pkg/sql/opt",
        "//pkg/sql/sem/tree",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/testcluster",
        "//pkg/util/leaktest",
        "//pkg/util/randutil",
    ],
)

filegroup(
    name = "testdata",
    srcs = glob(
        ["testdata/**"],
        exclude = [
            "**/*~",
            "**/#*#",
            "**/.*.swp",
            "**/.#*",
        ],
    ),
    visibility = [
        "//pkg/ccl/logictestccl:__subpackages__",
        "//pkg/cmd/generate-logictest:__pkg__",
        "//pkg/sql/opt/exec/execbuilder:__subpackages__",
    ],
)
